package com.meshnetics.gb.util.formatters;

/**
 * Mixed byte formatter - prefixed hex + unsigned decimal byte. For example 0 (0x00), 1 (0x01),
 * 10 (0x0A), 16 (0x10), 127 (0x7F), 128 (0x80), 255 (0xFF). Hex part separated from decimal by
 * space and packed to brackets.
 *
 * @author Yury Aserchev (yaserchev@meshnetics.com)
 *         Date: 30.07.2007 13:10:46
 */
final class ByteFormatterHexAndUByte implements ByteFormatter{
    public String format(final byte b) {
        final StringBuffer buff = new StringBuffer(ByteFormatters.DEC_UBYTE.format(b));
        buff.append(" (");
        buff.append(ByteFormatters.HEX_PREFIXED.format(b));
        buff.append(")");
        return buff.toString();
    }
}
